package cn.jjxx.modules.screen.service.impl;

import java.util.List;
import cn.jjxx.core.common.service.impl.CommonServiceImpl;
import cn.jjxx.core.query.data.Page;
import cn.jjxx.core.query.data.PageImpl;
import cn.jjxx.core.query.data.Pageable;
import cn.jjxx.core.query.data.Queryable;
import cn.jjxx.core.query.parse.QueryToWrapper;
import cn.jjxx.modules.screen.mapper.BigScreenTypeMapper;
import cn.jjxx.modules.screen.entity.BigScreenInfo;
import cn.jjxx.modules.screen.entity.BigScreenType;
import cn.jjxx.modules.screen.service.IBigScreenTypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.mapper.Wrapper;

/**   
 * @Title: big_screen_type
 * @Description: big_screen_type
 * @author yx
 * @date 2022-05-07 09:40:13
 * @version V1.0   
 *
 */
@Transactional
@Service("bigScreenTypeService")
public class BigScreenTypeServiceImpl  extends CommonServiceImpl<BigScreenTypeMapper,BigScreenType> implements  IBigScreenTypeService {

	@Override
	public boolean insertBatch(List<BigScreenType> list) {
		if(list!=null&&list.size()>0){
			return baseMapper.insertBatch(list);
		}
		return true;
	}

	@Override
	public boolean updateBatch(List<BigScreenType> list) {
		if(list!=null&&list.size()>0){
			return baseMapper.updateBatch(list);
		}
		return true;
	}
	
	@Override
	public Page<BigScreenType> list(String pages,Queryable queryable, Wrapper<BigScreenType> wrapper) {
		QueryToWrapper<BigScreenType> queryToWrapper = new QueryToWrapper<BigScreenType>();
		queryToWrapper.parseCondition(wrapper, queryable);
		// 排序问题
		queryToWrapper.parseSort(wrapper, queryable);
		Pageable pageable = queryable.getPageable(); 
		com.baomidou.mybatisplus.plugins.Page<BigScreenType> page = 
				new com.baomidou.mybatisplus.plugins.Page<BigScreenType>(
				Integer.parseInt(pages), pageable.getPageSize());
		com.baomidou.mybatisplus.plugins.Page<BigScreenType> content =  selectPage(page, wrapper);
		return new PageImpl<BigScreenType>(content.getRecords(), queryable.getPageable(), content.getTotal());
	}
}
